home *** CD-ROM | disk | FTP | other *** search
- From: clamage@Eng.Sun.COM (Steve Clamage)
- Message-ID: <4h7935$alj@engnews1.Eng.Sun.COM>
- X-Original-Date: 1 Mar 1996 16:36:53 GMT
- Path: in1.uu.net!bounce-back
- Date: 01 Mar 96 17:13:45 GMT
- Approved: fjh@cs.mu.oz.au
- Newsgroups: comp.std.c++
- Subject: Re: An Extra Virtual Destructor Question t
- Organization: Sun Microsystems Inc.
- References: <4h5c92$irn@fsgi01.fnal.gov>
- Reply-To: clamage@Eng.Sun.COM
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMTcwdeEDnX0m9pzZAQG9RwF8Dav38ycCRNwHXNZtGFeYgS57qDNvnUHq
- 99bsRzgailMGVdQLIdV9KUjBMV1YvJ91
- =L8dH
-
- In article irn@fsgi01.fnal.gov, b91926@fsgi01.fnal.gov (David Sachs) writes:
- >clamage@Eng.Sun.COM (Steve Clamage) writes:
-
- >>The compiler will generate calls to the pure virtual destructor if
- >>any derived type is destroyed (you can't create objects of type X).
- >>If you declare a member function, the compiler does not generate it
- >>for you. Thus, if you declare a pure virtual destructor, you usually
- >>must implement it as well.
-
- >Do you think it would be a good idea if the standard allowed
- >something like:
-
- >class X { virtual ~X()=0 {} } // Combined pure virtual + definition
-
- It complicates the syntax and language definition, and makes the code
- harder to read and understand. The code (IMHO) is more subject to errors
- in editing and maintaining.
-
- In exchange, the suggested syntax saves one line of code in the source text:
- X::~X() { } // 8 tokens
-
- It doesn't sound like a good tradeoff to me.
-
- ---
- Steve Clamage, stephen.clamage@eng.sun.com
- ---
- [ To submit articles: try just posting with your news-reader.
- If that fails, use mailto:std-c++@ncar.ucar.edu
- FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
- Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu.
- ]
-